/*
 * Copyright (C) 2010-2010 MaoJian Wu
 *
 * Author:
 *	MaoJian Wu
 *
 * Source:
 *	
 *
 * This file is a part of zfspear library.
 *
 *
 */

#include "stream_element.h"
#include "xmpp_uri.h"
#include "jid.h"

StreamElement::StreamElement():XmppElement("stream",XmppUri::STREAM) {
    //SetTagName("stream");
    //SetXmlns(XmppUri::STREAM);
        //QString a=this->TagName();
    //SetPrefix("stream");
}
const Jid* StreamElement::From() const {
    Jid *jid=new Jid();
    QString from=Attribute("from");
    if (jid->FromString(from))
        return jid;
    else
        return NULL;
}
void StreamElement::SetFrom (const Jid& jid) {
    this->SetAttribute("from",jid.ToString());
}

const Jid* StreamElement::To() const {
    Jid *jid=new Jid();
    QString to=Attribute("to");
    if (jid->FromString(to))
        return jid;
    else
        return NULL;
}
void StreamElement::SetTo(const Jid& jid) {
    SetAttribute("to",jid.ToString());
}

QString StreamElement::Id() const {
    return Attribute("id");
}
void StreamElement::SetId(const QString& id) {
    SetAttribute("id",id);
}

QString StreamElement::Xmllang() const {
    return Attribute("xml:lang");

}
void StreamElement::SetXmllang(const QString& xmllang) {

    SetAttribute("xml:lang",xmllang);

}

QString StreamElement::Version() const {
    return Attribute("version");
}
void StreamElement::SetVersion(const QString& version) {
    SetAttribute("version",version);
}
